package com.shujia.mr.hw.home3;


import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class Home3Part2Driver {
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);
        job.setJarByClass(Home3Part2Driver.class);
        job.setJobName("home3Part2");

        job.setMapperClass(Home3Part2Mapper.class);
        job.setReducerClass(Home3Part2Reducer.class);

        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(Student.class);
        job.setOutputKeyClass(NullWritable.class);
        job.setOutputValueClass(Student.class);

        FileInputFormat.addInputPath(job,new Path("output/home3"));
        FileOutputFormat.setOutputPath(job,new Path("output/home3Part2"));

        boolean result = job.waitForCompletion(true);
    }
}
